{include file="common/header"/}
<script>
$(function(){
    $('.layui-fluid .layui-tab-title li:first-child').addClass('layui-this');
    $('.layui-fluid .layui-tab-content .layui-tab-item:first-child').addClass('layui-show');
})
</script>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                    <div class="layui-row">
                        <div class="layui-tab layui-tab-card">
                            <ul class="layui-tab-title">
                                {volist name='confGroup' id='list' key="k"}
                                <li data-group="{$key}">{$list}</li>
                                {/volist}
                            </ul>
                            <div class="layui-tab-content">
                                {foreach name="confGroup" item="list" key="key1"}
                                <div class="layui-tab-item" data-group="{$key1}" style="left: 10px;top: 10px;">
                                    <form method="post" action="" class="MainForm layui-form layui-form-pane">
                                        {volist name='system' id='vo'}
                                        {eq name="vo.group" value="$key1"}
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">{$vo.title}</label>
                                            {switch name="vo.type"}
                                                {case value="string"}
                                                <div class="layui-input-inline">
                                                    <input type="text" name="{$vo.name}" value="{$vo.value}" placeholder="请输入{$vo.title}" class="layui-input">
                                                </div>
                                                {/case}
                                                {case value="text"}
                                                <div class="layui-input-inline">
                                                    <textarea name="{$vo.name}" placeholder="请输入{$vo.title}" class="layui-textarea">{$vo.value}</textarea>
                                                </div>
                                                {/case}
                                                {case value="file"}
                                                <div class="layui-input-block">
                                                <input type="hidden" name="{$vo.name}" value="{$vo.value}" id="logo" class="attach">
                                                    <div class="layui-upload">
                                                        <button type="button" class="layui-btn" id="selectAttach" data-href="{:url('sys.attach/select')}?mime=image"><i class="icon icon-upload3"></i>点击上传</button>
                                                        <div class="layui-upload-list">
                                                            <img class="layui-upload-img" style="width: 120px; max-height: 100px;" src="{$vo.value}" id="addPic">
                                                            <p id="demoText"></p>
                                                        </div>
                                                    </div>
                                                </div>
                                                {/case}
                                                {case value="radio"}
                                                <div class="layui-input-inline">
                                                <input type="radio" name="{$vo.name}" {eq name="vo.value" value="open"} checked {/eq} value="open" title="开启">
                                                <input type="radio" name="{$vo.name}" {eq name="vo.value" value="close"} checked {/eq} value="close" title="关闭">
                                                </div>
                                                {/case}

                                            {/switch}
                                            <div class="layui-form-mid layui-word-aux">{$vo.tip}</div>
                                        </div>
                                        {/eq}
                                        {/volist}
                                        <div class="layui-form-item">
                                            <div class="layui-input-block">
                                                <button type="button" class="layui-btn" lay-submit="" lay-filter="sys">提交</button>
                                                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                                            </div>
                                        </div>
                                    </form>
                                </div>
                                {/foreach}

                            </div>
                        </div>
                    </div>
            </div>
        </div>
    </div>
</div>
{include file="common/footer"/}
<script>
    layui.use(['form', 'layer','upload','element'], function () {
        var form = layui.form,layer = layui.layer,upload = layui.upload,$ = layui.jquery,element = layui.element;
        
        //提交监听
        form.on('submit(sys)', function (data) {
            loading =layer.load(1, {shade: [0.1,'#fff']});
            $.post("{:url('index')}",data.field,function(res){
                layer.close(loading);
                if(res.code > 0){
                    layer.msg(res.msg,{icon: 1, time: 1000},function(){
                        location.href = res.url;
                    });
                }else{
                    layer.msg(res.msg,{icon: 2, time: 1000});
                }
            });
        })
    })
</script>